import UploadFile from "@/components/FileUpload";
import { Col, ColProps, DatePicker, Form, FormInstance, Modal, Switch } from "antd";
import React from "react";


export type SettingDialogProps = {
  form: FormInstance
  onClose: () => void
  onOk: () => void
}


const layoutDef: {
  labelCol: ColProps
  wrapperCol: ColProps
} = {
  labelCol: {
    span: 6
  },
  wrapperCol: {
    span: 18
  }
}

const format = 'YYYY-MM-DD HH:mm:ss'

export function DialogSetting(props: SettingDialogProps) {

  return (
    <Modal
      visible
      title={'设置'}
      width={750}
      onCancel={props.onClose}
      onOk={props.onOk}
    >

      <Form form={props.form} {...layoutDef}>
        <Form.Item name={'startTime'} label='开始时间'>
          <DatePicker showTime format={format}></DatePicker>
        </Form.Item>
        <Form.Item name={'endTime'} label='结束时间'>
          <DatePicker showTime format={format}></DatePicker>
        </Form.Item>
        <Form.Item name={'popup'} label='是否自动弹出'>
          <Switch />
        </Form.Item>
        <Form.Item name={'ad_img'} label='广告图'>
          <UploadFile />
        </Form.Item>
      </Form>
    </Modal>
  )
}



